program example
use polymorphic_complextaylor
implicit none 
integer no,nv,n,i
type(taylor) f,g           !   <----------------------------- CHANGED!!
complex(dp) c, cc
integer, allocatable :: j(:),k(:),jj(:)


no=6; nv= 4;    ! no: the order of the polynomial    nv: the number of variables   
call init(no,nv)  ! initializes taylor series without maps

call alloc(f,g)      ! must be constructed after init



n=2
allocate(j(nv),k(n),jj(nv)) 

j=0
j(1)=1;j(2)=1;j(3)=2;j(4)=1;

jj=0
jj(1)=1;jj(2)=1;jj(3)=0;jj(4)=3;

k=0
do i=1, n
     k(i)=j(i)
end do



f=(2.d0.mono.j)  + (3.d0.mono.jj) + 4.d0  !  Creates (2.d0 x_1 x_ 2 x_3^2 x_ 4) + (3.d0 x_1 x_ 2  x_ 4^3) + 4.d0 
g=f<=k           !  Creates 2.d0 x_3^2 x_4  + 3.d0  x_ 4^3 and shifts exponents downwards by n

call print(f,6)
call print(g,6)

deallocate(j,k,jj)



f=(2.d0.mono.'2011')  +  (3.d0.mono.'2112' ) + 6.d0        ! <-------------  changed
     !  Creates 2.d0 x_1^2  x_3 x_ 4 + 3.d0 x_1^2 x_ 2 x_3 x_ 4^2 + 6.d0
g=f<='21'     ! Creates 3.d0 x_3 x_4^2 and shifts exponents downwards by '21'(two digits)

call print(f,6)
call print(g,6)



f=(2.d0.mono.'2101')  +  (3.d0.mono.'2102' ) + 6.d0
    !  Creates 2.d0 x_1^2 x_ 2  x_ 4 + 3.d0 x_1^2 x_ 2 x_ 4^2 + 6.d0
g=f<='210'     ! Creates 2.d0 x_4 + 3.d0 x_4^2 and shifts exponents downwards by '210'(three digits)

call print(f,6)
call print(g,6)


f=(2.d0.mono.'2111')  +  (3.d0.mono.'2112' ) + 6.d0
    !  Creates 2.d0 x_1^2 x_ 2 x_3 x_ 4 + 3.d0 x_1^2 x_ 2 x_3 x_ 4^2 + 6.d0
g=f<='2'     ! Creates 2.d0 x_2 x_3x_4 + 3.d0 x_2 x_3 x_4^2 and shifts exponents downwards by '2'(one digit)

call print(f,6)
call print(g,6)


call kill(f,g)      ! must be destroyed
end program example